//
//  StudentDetailView.m
//  UI11_Address
//
//  Created by dllo on 15/10/23.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "StudentDetailView.h"
#import "Students.h"
@interface StudentDetailView ()


@property (nonatomic, retain)UILabel *nameLabel;
@property (nonatomic, retain)UILabel *phoneLabel;
@property (nonatomic, retain)UILabel *genderLabel;

@end

@implementation StudentDetailView




- (void)dealloc
{

    [_headImageView release];
    [_genderField release];
    [_phoneField release];
    [_genderField release];
    [_phoneLabel release];
    [_genderLabel release];
    [_nameLabel release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self ceateSubView];
    }
    return self;
}

-(void)ceateSubView
{

    
    self.headImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 150, 150, 180)];
    self.headImageView.userInteractionEnabled = YES;
    [self addSubview:self.headImageView];
    [_headImageView release];

    
    
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(170, 150, 60, 30)];
    self.nameLabel.text = @"姓名 :";
    self.nameLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:self.nameLabel];
    [_nameLabel release];
    
    self.phoneLabel = [[UILabel alloc]initWithFrame:CGRectMake(170, 220, 60, 30)];
    self.phoneLabel.text = @"电话号:";
    self.phoneLabel.textAlignment =  NSTextAlignmentRight ;
    [self addSubview:self.phoneLabel];
    [_phoneLabel release];

    self.genderLabel = [[UILabel alloc]initWithFrame:CGRectMake(170, 290, 60, 30)];
    self.genderLabel.text = @"性别 :";
    self.genderLabel.textAlignment =  NSTextAlignmentRight ;
    [self addSubview:self.genderLabel];
    [_genderLabel release];

    //自定义cell步骤
    /*自定义cell第一步:创建cell继承于UITaleViewCell
     *自定义cell第二步:重写初始化方法
     *自定义cell第三步:布局子视图
     *自定义cell第四步:替换系统的UITableViewCell
     *自定义cell第五步:注册自定义的cell
     *自定义cell第六步:给cell传值
     *自定义cell第七步:重写setter方法传值
     */
    
    self.nameField = [[UITextField alloc]initWithFrame:CGRectMake(235, 150, 130, 30)];
    self.nameField.backgroundColor = [UIColor colorWithRed:0.207 green:0.350 blue:1.000 alpha:1.000];
    self.nameField.borderStyle = UITextBorderStyleRoundedRect;
    [self addSubview:self.nameField];
    [_nameField release];
    
    self.phoneField = [[UITextField alloc]initWithFrame:CGRectMake(235, 220, 130, 30)];
    self.phoneField.backgroundColor = [UIColor colorWithRed:1.000 green:0.722 blue:0.356 alpha:1.000];
    self.phoneField.borderStyle = UITextBorderStyleRoundedRect;
    self.phoneField.keyboardType = UIKeyboardTypeNumberPad;
    [self addSubview:self.phoneField];
    [_phoneField release];
    
    self.genderField = [[UITextField alloc]initWithFrame:CGRectMake(235, 290, 130, 30)];
    self.genderField.backgroundColor = [UIColor colorWithRed:0.535 green:0.991 blue:0.807 alpha:1.000];
    self.genderField.borderStyle = UITextBorderStyleRoundedRect;
    [self addSubview:self.genderField];
    [_genderField release];
    
    //轻拍手势
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)];
    [self.headImageView addGestureRecognizer:tap];
    [tap release];
    
}


-(void)tapAction:(UITapGestureRecognizer *)tap
{
    [self.studentDVDelegate presentToViewController];
}


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.nameField resignFirstResponder];
    [self.phoneField resignFirstResponder];
    [self.genderField resignFirstResponder];
}





/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
